package com.qt.eurekaClientSearch.controller;

import com.qt.eurekaClientSearch.entity.Product;
import com.qt.eurekaClientSearch.rpc.UserRpcClient;
import com.qt.result.Result;
import org.apache.commons.lang3.RandomUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Random;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.atomic.LongAdder;

/**
 * Despription:
 *
 * @Autor: xusl
 * @Date: 2019/6/19 16:15
 * @Version: 1.0
 **/
@RestController
@RequestMapping("search")
public class SearchController {

    @Autowired
    private UserRpcClient userRpcClient;

    @GetMapping(value = "/product_query")
    public Result productQuery(@RequestParam(value = "pageSize", required = false, defaultValue = "5") Integer pageSize,
                               @RequestParam(value = "pn", required = false, defaultValue = "1") Integer pn,
                               @RequestBody Product product) {
        System.out.println("=======product=========" + product.toString() + "   pagesize =" + pageSize + "  pn =" + pn);
        Result query = userRpcClient.queryByPage(pageSize, pn, product);
        return query;
    }
}
